//
//  ChooseProController.m
//  BigToBig
//
//  Created by 毛丽媛 on 16/8/9.
//  Copyright © 2016年 cn.cloudtp. All rights reserved.
//

#import "ChooseProController.h"
#import "ChooseProTableViewCell.h"

@interface ChooseProController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView *tableView;
@property(nonatomic,strong)NSMutableArray *cellArr;
@property(nonnull,assign)BOOL *selected;


@end

@implementation ChooseProController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setBackBar];
    UILabel *titleLab = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 40)];
    titleLab.text = @"已选项目";
    titleLab.textColor = [UIColor whiteColor];
    [self setBackBar];
    titleLab.textAlignment = NSTextAlignmentCenter;
    self.navigationItem.titleView = titleLab;
    self.navigationController.navigationBar.barTintColor = COLOR_RGBA(77, 155, 255, 1);
    self.view.backgroundColor=GRAYCOLOR;
    
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - 64)];
    [self.view addSubview:self.tableView];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.separatorStyle = NO;
    self.tableView.bounces = NO;
    self.tableView.backgroundColor = [UIColor colorWithWhite:0.938 alpha:1.000];
    
    self.tableView.showsVerticalScrollIndicator = NO;
    
    self.cellArr = [[NSMutableArray alloc] initWithObjects:@"1",@"2",@"3",@"4",@"5",@"6", nil];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.cellArr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    tableView.separatorStyle = YES;
    
    static NSString *CellIdentifier = @"BasicInfoTableViewCell";
    
    ChooseProTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    
    if (!cell)
        cell = [[ChooseProTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    cell.proLabel.text = @"报名项目: 好的水杯";
    cell.timeLabel.text = @"报名时间: 2016-08-04 12:25-12:40";
    cell.agree.layer.borderColor = [COLOR_RGBA(255, 255, 255, 1) CGColor];
    [cell.unAgree setTitle:@"取消资格" forState:UIControlStateNormal];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    [cell.unAgree addTarget:self action:@selector(time1:) forControlEvents:UIControlEventTouchUpInside];
    return cell;
}

- (void)time1:(UIButton *)btn{
    
    btn.selected = !btn.selected;
    
    if (btn.selected) {
        btn.layer.borderColor = [COLOR_RGBA(248, 64, 54, 1) CGColor];
    }else{
        btn.layer.borderColor = [COLOR_RGBA(217, 217, 217, 1) CGColor];
    }
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 140;
}

#pragma mark 导航栏左右Button
- (void)setBackBar{
    
    BackButton *backBtn=[BackButton buttonWithType:UIButtonTypeCustom];
    backBtn.frame = CGRectMake(0, 0, 44, 44);
    [backBtn addTarget:self action:@selector(backController:) forControlEvents:UIControlEventTouchUpInside];
    [backBtn setImage:[UIImage imageNamed:@"返回"] forState:UIControlStateNormal];
    [backBtn.imageView setContentMode:UIViewContentModeLeft];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:backBtn];
    [self.navigationItem setHidesBackButton:YES animated:YES];
    
    
}

- (void)backController:(UIButton *)button{
    [self.navigationController popViewControllerAnimated:YES];
    self.tabBarController.tabBar.hidden = YES;
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
